package com.skynet.springboot.mybatis.springmybatis.dto;

import lombok.Data;

import java.io.Serializable;

/**
 * @author Skynet
 * @Date 2017/9/12-20:51.
 */
@Data
public class ResultBean<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    public static final int SUCCESS = 0;
    public static final int FAIL = 1;
    public static final int NO_PERMISSION = 2;

    private String msg = "success";
    private int code = SUCCESS;
    private T data;

    public ResultBean() {
    }

    public ResultBean(T data) {
        this.data = data;
    }

    public ResultBean(Throwable e) {
        this.msg = e.toString();
        this.code = FAIL;
    }
}
